package com.camps.sdk.decrypt;

import com.camps.sdk.common.Constants;
import com.camps.sdk.entity.DeviceUpMessage;
import com.camps.sdk.entity.SOSSwitch;

/**
 * @Author ldaoliang
 * @Date create in 15:58 2021/9/1
 * @Description
 */
public class AnalyzeSosSwitch implements AnalyticalData {
    @Override
    public DeviceUpMessage parseData(String originalData)
    {
        // *WT,866248050395985,V4,SOSFUN,000734,1,FFFFDFFF#
        //解密
        String[] split = parseCommand(originalData);
        String imei=split[1];
        String commandNumber=split[4];
        String flag=split[5];//0:SOS循环拨号，默认值；1关闭SOS拨号；
        String deviceStatus=split[6];//设备状态
        SOSSwitch sosSwitch = new SOSSwitch();
        sosSwitch.setImei(imei);
        sosSwitch.setDeviceTime(commandNumber);
        sosSwitch.setCommandNumber(commandNumber);
        sosSwitch.setFlag(Integer.parseInt(flag));
        sosSwitch.setDeviceStatus(deviceStatus);
        return structureMessage(Constants.REPLY,Constants.CMD_SOS_SWITCH,false,"",sosSwitch);
    }
}
